/*
 * @Description: 
 * @Author: rendc
 * @Date: 2024-10-12 17:22:58
 * @LastEditors: rendc
 * @LastEditTime: 2024-10-12 17:27:58
 */
/**
 * Customer
 */
public class Customer implements Runnable {
  private BaoZiShop shop;

  public Customer(BaoZiShop shop) {
    this.shop = shop;
  }

  @Override
  public void run() {
    while (true) {
      String baoZiType = shop.sellBaoZi();
      System.out.println(Thread.currentThread().getName() + "买到了" + baoZiType + "包。");
      try {
        Thread.sleep(1000);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }
}